package com.ny.wlw;

import java.sql.SQLException;
import java.util.Scanner;

public class ViewMain {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        System.out.println("欢迎来到用户管理系统");
        System.out.println("请选择对应的操作");
        System.out.println("1.登录");
         System.out.println("2.注册");
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
         switch (i) {
            case 1:
                System.out.println("请输入用户名");
                String name = scanner.next();
                System.out.println("请输入密码");
                String password = scanner.next();
                UserDao userDao = new UserDao();
                User user = userDao.findUser(name,password);
                if (user != null) {
                    System.out.println("登录成功");
                }
                break;
                case 2:
                     System.out.println("请输入用户名");
                     String name = scanner.next();
                     System.out.println("请输入密码");
                     String password = scanner.next();
                      UserDao userDao = new UserDao();
                      userDao.addUser(name,password);
                       System.out.println("添加成功");

                        break;

         }
    }
}
